package com.wanyang.controller;

import com.wanyang.dto.PageDTO;
import com.wanyang.service.FollowerService;
import com.wanyang.service.GoldShopService;
import com.wanyang.service.LevelExperienceService;
import com.wanyang.service.MemberService;
import com.wanyang.vo.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "游客api")
@RestController
@RequestMapping("visit")
public class VisitorController {

    @Autowired
    private MemberService memberService;

    @Autowired
    private FollowerService followerService;

    @Autowired
    private LevelExperienceService levelExperienceService;

    @Autowired
    private GoldShopService goldShopService;

    @ApiOperation(value = "查看某个用户个人信息")
    @GetMapping("member/{memberId}")
    public ApiResult memberInfo(@PathVariable Integer memberId) {
        return ApiResult.success(memberService.getModel(memberId), null);
    }

    @ApiOperation(value = "查看某人的粉丝列表")
    @GetMapping("/{memberId}/fansList")
    public ApiResult fansList(PageDTO pageDTO, @PathVariable Integer memberId) {
        return ApiResult.success(followerService.fansList(memberId, pageDTO), null);
    }


    @ApiOperation(value = "查看某人的关注列表")
    @GetMapping("/{memberId}/followedList")
    public ApiResult followedList(PageDTO pageDTO, @PathVariable Integer memberId) {
        return ApiResult.success(followerService.followedList(memberId, pageDTO), null);
    }



    @GetMapping("top10")
    @ApiOperation(value = "等级top10")
    public ApiResult top10() {
        return ApiResult.success(levelExperienceService.listTop10(), null);
    }


    @GetMapping("goldGoodsList")
    @ApiOperation(value = "金币商城 - 商品列表")
    public ApiResult goldGoodsList(PageDTO pageDTO) {

        return ApiResult.success(goldShopService.selectGoodsList(pageDTO), null);
    }

    @GetMapping("goldGoodsDetail/{goodsId}")
    @ApiOperation(value = "金币商城 - 商品详情")
    public ApiResult goldGoodsDetail(@PathVariable Integer goodsId) {

        return ApiResult.success(goldShopService.selectGoodsDO(goodsId), null);
    }

}
